package org.apache.ocean;

/**
 *
 * @author jasonr
 */
public class CDouble implements Comparable<CDouble> {
  public double value;
  
  public CDouble(double value) {
    this.value = value;
  }
  
  public CDouble(String string) {
    value = Double.parseDouble(string);
  }
  
  public String toString() {
    return Double.toString(value);
  }
  
  public int hashCode() {
    long bits = Double.doubleToLongBits(value);
    return (int)(bits ^ (bits >>> 32));
  }
  
  public boolean equals(Object obj) {
    return (obj instanceof CDouble) && (Double.doubleToLongBits(((CDouble)obj).value) == Double.doubleToLongBits(value));
  }
  
  public int compareTo(CDouble anotherDouble) {
    return Double.compare(value, anotherDouble.value);
  }
}
